package com.turing.post.capitalaccounts.util;

import java.math.BigInteger;
import java.util.Date;
import java.util.List;

import javax.ejb.Local;
import javax.ejb.Remote;

import com.turing.post.util.PCPSApplicationException;
import com.turing.post.util.PCPSWebInput;

/**
 * 银行帐户入账流水Dao接口
 * 
 * @author liun
 * @date 2013-05-29
 */
@Remote
@Local
public interface BankAccountDetailDao {

	/**
	 * 根据id获取银行账户入账流水
	 * 
	 * @param bankAccDetailId
	 *            银行账户入账流水ID
	 * @return
	 */
	public BankAccountDetail getBankAccountDetailByID(BigInteger bankAccDetailId);

	/**
	 * 根据银行账户ID获取银行账户入账流水
	 * 
	 * @param bankAccountId
	 *            银行账户ID
	 * @param page
	 *            分页号
	 * @return
	 */
	public List<BankAccountDetail> getBankAccountDetailByAccID(
			PCPSWebInput webInput, BigInteger accountNoId, String status,
			Date startDate, Date endDate, String voucherNo,
			BigInteger startAmount, BigInteger endAmount,
			BigInteger createBranchNo, String isSingle, String paidType, String lenghtSection,
			Integer page);

	/**
	 * 获取银行账户入账流水总数
	 * 
	 * @param bankAccountId
	 *            银行账户ID
	 * @return
	 */
	public Integer getBankAccountDetailByAccIDTotal(PCPSWebInput webInput,
			BigInteger accountNoId, String status, Date startDate,
			Date endDate, String voucherNo, BigInteger startAmount,
			BigInteger endAmount, BigInteger createBranchNo, String isSingle,
			String paidType, String lenghtSection);

	/**
	 * 获取银行账户入账流水总数
	 * 
	 * @param bankAccountId
	 *            银行账户ID
	 * @return
	 */
	public Integer getBankAccountDetailTotalByCond(PCPSWebInput webInput,
			String branchNo, String status);

	/**
	 * 添加一条银行账户入账流水明细
	 * 
	 * @param entity
	 */
	public void addBankAccountDetail(BankAccountDetail entity)
			throws PCPSApplicationException;

	/**
	 * 根据ID删除一条银行账户入账流水明细
	 * 
	 * @param entity
	 */
	public void delBankAccountDetail(BankAccountDetail entity)
			throws PCPSApplicationException;

	/**
	 * 锁定一条银行账户入账流水明细
	 * 
	 * @return
	 */
	public BankAccountDetail getBankAccountDetailForUpdate(
			BigInteger bankAccDetailId);

	/**
	 * 修改一条银行账户入账流水明细
	 * 
	 * @param entity
	 * @throws PCPSApplicationException
	 */
	public void modifyBankAccountDetail(BankAccountDetail entity)
			throws PCPSApplicationException;

	/**
	 * @param paidBankAccountId
	 * @param voucherNo
	 * @return
	 */
	// public BankAccountDetail getBankAccountDetailByVoucher(String voucherNo);
	/**
	 * 根据凭证号、凭证金额和银行ID查询入账流水
	 * 
	 * @param bankAccountId
	 *            银行Id
	 * @param voucherNo
	 *            凭证号
	 * @param voucherAmount
	 *            凭证金额
	 * @return
	 */
	public BankAccountDetail getBankAccountDetailByVoucherAndAmount(
			BigInteger bankAccountId, String voucherNo, BigInteger voucherAmount);

	/**
	 * 根据唯一索引查询
	 * 
	 * @param voucherNo
	 *            凭证号
	 * @param paidBankAccountId
	 *            付款人银行帐号
	 * @param status
	 *            状态
	 * @return
	 */
	public BankAccountDetail getBankAccountDetailByUNI(String voucherNo,
			BigInteger paidBankAccountId, String status);

	/**
	 * 获取银行账户入账流水总金额
	 * 
	 * @param webInput
	 * @param accountNo
	 * @param bankAccSeqNo
	 * @param startDate
	 * @param endDate
	 * @param voucherNo
	 * @param startAmount
	 * @param endAmount
	 * @return
	 */
	public BigInteger getBankAccountDetailByTotalAmount(PCPSWebInput webInput,
			BigInteger accountNoId, String status, Date startDate,
			Date endDate, String voucherNo, BigInteger startAmount,
			BigInteger endAmount, BigInteger createBranchNo, String isSingle);

	/**
	 * 根据发卡机构号，获取当前发卡机构号账户入账综合
	 * 
	 * @param issueBranchNo
	 *            发卡机构号
	 * @return
	 */
	public BigInteger getVoucherAmountTotalByIssueBranchNo(
			String issueBranchNo, String tranDate);

	/**
	 * 打包提交时下拉银行入账流水编号
	 * 
	 * @param webInput
	 * @param SaleBranchNo
	 * @return
	 */
	public List<BankAccountDetail> getBankAccountDetailListBySaleBranchNo(
			PCPSWebInput webInput);

	/**
	 * 销售单银行转账时选择的记录
	 * 
	 * @param webInput
	 * @param saleBranchNo
	 * @return
	 */
	public List<BankAccountDetail> getBankAccountDetailList(
			PCPSWebInput webInput, String saleBranchNo, int page);

	public Integer getBankAccountDetailTotal(PCPSWebInput webInput,
			String saleBranchNo);

	/**
	 * 检查凭证号是否已经被使用了
	 * 
	 * @param issueCompanyNo
	 * @param voucherNo
	 * @return
	 */
	public Integer checkBankAccountDetailVoucherNo(String issueCompanyNo,
			String voucherNo);

	/**
	 * 根据凭证号、银行记账流水号和银行ID查询入账流水
	 * 
	 * @param bankAccountId
	 *            银行ID
	 * @param voucherNo
	 *            凭证号
	 * @param bankAccSeqNo
	 *            银行记账流水号
	 * @return
	 */
	public BankAccountDetail getBankAccountDetailByVoucherAndBankAccSeqNo(
			BigInteger bankAccountId, String voucherNo, String bankAccSeqNo);

}
